package API002;

public class StringBufferDemo {
    public static void main(String[] args) {
        StringBuffer sb = new StringBuffer();
        sb.append("geffag").insert(1,"it").delete(1,4).replace(1,3,"hh");
        int[] arr = {1,2,3,4,5};
        System.out.println(toString(arr));
    }
    public static StringBuffer toString(int[] arr) {
        StringBuffer sb = new StringBuffer();
        sb.append("[");
        for (int i = 0;i < arr.length;i++){
            if(i != arr.length - 1) {
                sb.append(arr[i] + ",");
            } else {
                sb.append(arr[i] + "]");
            }
        }
        return sb;
    }
}
